import request from '@/utils/request';

// 获取
export function getTotalsData() {
  return request({
    url: '/energyApp/homePage/collectDateAnalysis',
    method: 'get'
  });
}
// 获取
export function getCompData() {
  return request({
    url: '/energyApp/homePage/companyDataStatistics',
    method: 'get'
  });
}
// 获取
export function getwaybillsData() {
  return request({
    url: '/energyApp/homePage/waybillAlarm',
    method: 'get'
  });
}
// 获取
export function getDeviceData() {
  return request({
    url: '/energyApp/homePage/deviceAlarm',
    method: 'get'
  });
}
// 获取菜单权限
export function getMennus() {
  return request({
    url: '/system/user/getUserDetail',
    method: 'get'
  });
}
// 获取
export function getDeviceLists(params) {
  let result = '';
  for (const propName of Object.keys(params)) {
    const value = params[propName];

    if (value !== null && value !== '' && typeof value !== 'undefined') {
      result += `${propName}=${value}&`;
    }
  }
  return request({
    url: `/energyApp/homePage/ticketDeviceAlarmPage?${result.slice(0, -1)}`,
    method: 'get'
  });
}
// 获取
export function getwaybillLists(params) {
  let result = {};
  for (const propName of Object.keys(params)) {
    const value = params[propName];
    if (typeof value === Array) {
    }
    if (value !== null && value !== '' && typeof value !== 'undefined') {
      result[propName] = value;
    }
  }
  return request({
    url: '/energyApp/homePage/waybillAlarmPage',
    method: 'post',
    data: result
  });
}
